Skip to content

Make policy stop test deterministic#70

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
deterministic-policy-stop-test
Jul 1, 2026
Merged

Make policy stop test deterministic#70
samuel-williams-shopify merged 1 commit into
mainfrom
deterministic-policy-stop-test

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

The "can stop the container from child_exit" test was racy. All three workers called exit(1) immediately, so multiple child_exit callbacks could fire before container.stop took effect. The policy guards with unless container.stopping?, but that's a check-then-act race — several children can each observe stopping? == false and increment stop_count, making the stop_count == 1 assertion flaky.

Fix

Only the first worker exits, and only after all workers are ready (coordinated via a pipe). The others sleep. This guarantees exactly one child_exit drives the stop, so stop_count is deterministically 1.

Test-only, no library change. Verified stable across repeated runs.

Assisted-By: devx/904563b8-dbee-48b0-9726-f036df3ed96d
@samuel-williams-shopify samuel-williams-shopify merged commit fc7a893 into main Jul 1, 2026
32 of 40 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the deterministic-policy-stop-test branch July 1, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant